# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=lazydroid
pkgver=25.0f559ec
pkgrel=1
pkgdesc='Tool written as a bash script to facilitate some aspects of an Android Assessment'
arch=('any')
groups=('blackarch' 'blackarch-mobile' 'blackarch-automation' 'blackarch-binary')
url='https://github.com/nccgroup/LazyDroid'
license=('Apache')
depends=('wget')
makedepends=('git')
source=("$pkgname::git+https://github.com/nccgroup/LazyDroid.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)

}

prepare() {
  cd $pkgname

  sh getfridalibs.sh
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -r media

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec sh lazyDroid.sh
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

